Don't call iptables if it is not installed. This code is only there to ensure
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 11 Nov 2005 16:56:02 +0000 (17:56 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 11 Nov 2005 16:56:02 +0000 (17:56 +0100)
that packets between domU and the bridge are not firewalled, so if iptables is
not installed, then there is no worry.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/examples/vif-common.sh

index 0f8fcc706f99c4671ba177c77f4606e766a498ed..273cbacab50fdbda29eb123dbb9ec0675c7f4e8f 100644 (file)
@@ -53,7 +53,8 @@ function frob_iptable()
     local c="-D"
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT
+  iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT ||
+    fatal "iptables $c FORWARD -m physdev --physdev-in $vif $@ -j ACCEPT failed"
 }
 
 
@@ -66,6 +67,11 @@ function frob_iptable()
 #
 function handle_iptable()
 {
+  if ! which iptables >&/dev/null
+  then
+    return
+  fi
+
   if [ "$ip" != "" ]
   then
       local addr